cmake_minimum_required( VERSION 3.10 FATAL_ERROR )

project( "KTX-main" LANGUAGES CXX )

set( AE_EXTERNAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../.." )
include( "${AE_EXTERNAL_PATH}/config.cmake" )

# SIMD
if (AE_CPU_ARCH_X64 OR AE_CPU_ARCH_X86)
	if (${AE_SIMD_AVX} GREATER 0)
		set( ASTCENC_ISA_SSE41  ON  CACHE BOOL "" FORCE )
		set( BASISU_SUPPORT_SSE	ON  CACHE BOOL "" FORCE )

	elseif (${AE_SIMD_SSE} GREATER_EQUAL 41)
		set( ASTCENC_ISA_SSE41 	ON  CACHE BOOL "" FORCE )
		set( BASISU_SUPPORT_SSE	ON  CACHE BOOL "" FORCE )

	elseif (${AE_SIMD_SSE} GREATER_EQUAL 20)
		set( ASTCENC_ISA_SSE41 	OFF CACHE BOOL "" FORCE )
		set( ASTCENC_ISA_SSE2  	ON  CACHE BOOL "" FORCE )
		set( BASISU_SUPPORT_SSE	ON  CACHE BOOL "" FORCE )

	else()
		set( ASTCENC_ISA_SSE41 	OFF CACHE BOOL "" FORCE )
		set( ASTCENC_ISA_SSE2  	OFF CACHE BOOL "" FORCE )
		set( ASTCENC_ISA_NEON  	OFF CACHE BOOL "" FORCE )
		set( ASTCENC_ISA_NONE  	ON  CACHE BOOL "" FORCE )
		set( BASISU_SUPPORT_SSE	OFF CACHE BOOL "" FORCE )
	endif()
endif()

if (AE_CPU_ARCH_ARM32 OR AE_CPU_ARCH_ARM64)
	set( ASTCENC_ISA_SSE41 	OFF CACHE BOOL "" FORCE )
	set( ASTCENC_ISA_SSE2  	OFF CACHE BOOL "" FORCE )
	set( ASTCENC_ISA_NONE  	OFF CACHE BOOL "" FORCE )
	set( BASISU_SUPPORT_SSE	OFF CACHE BOOL "" FORCE )
endif()
if (AE_CPU_ARCH_ARM64)
	set( ASTCENC_ISA_NEON  	ON  CACHE BOOL "" FORCE )
endif()

set( KTX_FEATURE_DOC			OFF CACHE BOOL "" FORCE )
set( KTX_FEATURE_GL_UPLOAD		OFF CACHE BOOL "" FORCE )
set( KTX_FEATURE_JNI			OFF CACHE BOOL "" FORCE )
set( KTX_FEATURE_KTX1			ON  CACHE BOOL "" FORCE )
set( KTX_FEATURE_KTX2			ON  CACHE BOOL "" FORCE )
set( KTX_FEATURE_STATIC_LIBRARY	ON  CACHE BOOL "" FORCE )
set( KTX_FEATURE_TESTS			OFF CACHE BOOL "" FORCE )
set( KTX_FEATURE_TOOLS			ON  CACHE BOOL "" FORCE )
set( KTX_FEATURE_VK_UPLOAD		OFF CACHE BOOL "" FORCE )

include( "origin_CMakeLists.txt" )
